<template>
	<view class="pageBox">
		<view class="con">
			<view class="infoBox" v-for="(item,index) in info.orderGoods" :key="index">
				<view class="info flex">
					<image class="thumb" :src="item.thumb"></image>
					<view class="infoR">
						<view class="infoRT">
							{{item.title}}
						</view>
						<view class="infoRB flex-between">
							<view class="price">
								¥{{item.price}}
							</view>
							<view class="sku">
								x {{item.num}}
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>

		<view class="menu">
			<view class="menuItem flex-between" v-if="info.status == 1 || info.status == 2" @click="goOnlyRefund">
				<image class="arrowRight" src="http://www.bobei.shop/static/afterSale/jinTuiKuan.png" mode=""></image>
				<view class="itemCon">
					<view class="itemConTop">
						仅退款
					</view>
					<view class="itemConBom">
						未收到货（包含未签收），或卖家协商同意前提下
					</view>
				</view>
				<uni-icons type="right" size="15" color="#666666"></uni-icons>
			</view>
			
			<view class="menuItem flex-between" v-if="info.status == 2" @click="goReturnGoods">
				<image class="arrowRight" src="http://www.bobei.shop/static/afterSale/tuiHuoTuiKuan.png" mode=""></image>
				<view class="itemCon">
					<view class="itemConTop">
						退货退款
					</view>
					<view class="itemConBom">
						已收到货，需要退还已收到的货物
					</view>
				</view>
				<uni-icons type="right" size="15" color="#666666"></uni-icons>
			</view>
		</view>
	</view>
</template>

<script>
	
	export default {
		data() {
			return {
				id: "",
				goodsId: "",
				orderGoodsId: "",
				info: {
					"orderNo": "",
					"addressId": {
						"name": "",
						"mobile": "",
						"address": ""
					},
					"status": 0,
					"num": 1,
					"orderGoods": [{
						"id": 3779,
						"shopId": 0,
						"orderId": 3705,
						"goodsId": 42427,
						"price": "0.00",
						"status": 0,
						"refundId": 0,
						"refundNum": 0,
						"refundMoney": "0.00",
						"deletedAt": null,
						"createdAt": "2022-11-18 11:16:54",
						"updatedAt": "2022-11-18 11:16:54",
						"specs": "",
						"specTitle": "",
						"credits": 0,
						"num": 1,
						"title": "",
						"thumb": "",
						"genre": 0,
						"marketprice": "0.00",
						"score": 0,
						"commentType": 0,
						"refund": null
					}]
				}
			}
		},
		onLoad(option) {
			this.id = option.id;
			this.goodsId = option.goodsId;
			this.orderGoodsId = option.orderGoodsId;
			this.getINfo();
		},
		methods: {
			getINfo() {
				this.$post({
					url: '/portal/Shop',
					module: 'Order',
					interface: '1001',
					data: {
						id: Number(this.id)
					}
				}).then(res => {
					this.info = res;
				})
			},
			goOnlyRefund() {
				uni.navigateTo({
					url: "/afterSale/onlyRefund?id=" + this.info.id + "&goodsId=" + this.info.goodsId + "&orderGoodsId=" + this.orderGoodsId + "&refundType=0"
				})
			},
			goReturnGoods() {
				uni.navigateTo({
					url: "/afterSale/onlyRefund?id=" + this.info.id + "&goodsId=" + this.info.goodsId + "&orderGoodsId=" + this.orderGoodsId + "&refundType=1"
				})
			},
		},
	}
</script>

<style lang="scss" scoped>
	.pageBox {
		padding: 32rpx;
		width: 100%;
		min-height: calc(100vh - var(--window-top));
		background-color: #f9f9f9;

		.con {
			background-color: #ffffff;
			border-radius: 16rpx;

			.infoBox {
				padding: 32rpx;

				.info {

					.thumb {
						width: 160rpx;
						height: 160rpx;
						border-radius: 16rpx;
					}

					.infoR {
						flex: 1;
						padding-left: 10rpx;
					}

					.infoRT {
						width: 100%;
						word-break: break-all;
						text-overflow: ellipsis;
						overflow: hidden;
						display: -webkit-box;
						-webkit-box-orient: vertical;
						-webkit-line-clamp: 2;
						/* 这里是超出几行省略 */
						font-size: 28rpx;
						font-family: PingFangSC-Regular, PingFang SC;
						font-weight: 400;
						color: #000000;
						line-height: 44rpx;
					}

					.infoRB {
						margin-top: 20rpx;

						.price {
							font-size: 28rpx;
							font-family: PingFangSC-Regular, PingFang SC;
							font-weight: 400;
							color: #000000;
							line-height: 48rpx;
						}

						.sku {
							font-size: 28rpx;
							font-family: PingFangSC-Regular, PingFang SC;
							font-weight: 400;
							color: #afa9b0;
							line-height: 48rpx;
						}
					}
				}

			}
		}

		.menu {
			background-color: #ffffff;
			border-radius: 16rpx;
			margin-top: 32rpx;
			

			.menuItem {
				padding: 32rpx;
				border-bottom: 2rpx solid #F0F0F0;
				.arrowRight {
					width: 60rpx;
					height: 60rpx;
				}
				.itemCon {
					flex: 1;
					padding: 0 30rpx;
					.itemConTop {
						font-size: 30rpx;
						font-family: PingFang SC;
						font-weight: 400;
						line-height: 44rpx;
						color: #1F0F26;
					}
					.itemConBom {
						margin-top: 20rpx;
						font-size: 26rpx;
						font-family: PingFang SC;
						font-weight: 400;
						line-height: 44rpx;
						color: #666666;
					}
				}
			}
			.menuItem:nth-last-of-type(1) {
				border-bottom: 0;
			}
		}

	}
</style>
